package com.wxw.teacher.controller;



import com.wxw.commonutils.R;
import com.wxw.teacher.entity.AdminTeacher;
import com.wxw.teacher.service.IAdminTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 讲师 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-01-03
 */
@RestController
@RequestMapping("/teacher")
public class AdminTeacherController {

    @Autowired
    public IAdminTeacherService adminTeacherService;

    //查所有教师
    @GetMapping("findAllTeacher")
    public R findAllTeacher(){
        List<AdminTeacher> teachersList = adminTeacherService.list(null);
        return R.ok().data("item",teachersList);
    }

    //逻辑删除教师
    @DeleteMapping("{id}")
    public R removeTeacher(@PathVariable String id){
        boolean remove = adminTeacherService.removeById(id);
        return remove?R.ok():R.error();
    }

}

